﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Graphene.Storing
{
    /**
     * Represents a two dimensional geometric point.
     * Integer values are used only.
     */
    public class PointInt2D : Graphene.Storing.Point
    {           
        public PointInt2D(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return false;
            }

            PointInt2D p = obj as PointInt2D;
            if ((System.Object) p == null)
            {
                return false;
            }
        
            return (this.x == p.X) && (y == p.Y);
        }

        public bool Equals(PointInt2D p)
        {            
            if ((object) p == null)
            {
                return false;
            }
            
            return (this.x == p.X) && (this.y == p.Y);
        }

        public override int GetHashCode()
        {
            return this.x ^ this.y;
        }

        public int X
        {
            get { return x; }            
        }

        public int Y
        {
            get { return y; }            
        } 

        private int x;
        private int y; 
    }
}
